<?php
namespace Common\Payment;
use Think\Controller;

class AltercardsPayment extends Controller {

	public function params() {
		$arr['logo'] = "Altercards.png";
		$arr['front_desc'] = "这是一个信用卡支付网关的描述";
		$arr['back_desc'] = "这是后台显示的描述";
		$arr['title'] = "Credit Card Payment";
		return $arr;
	}

	public function config() {
		$this->display(T('Common@Payment/Altercards/config'));
	}

	public function front() {
		$this->display(T('Common@Payment/Altercards/front'));
	}

	public function process($order_id, $payment_data, $order_data) {
		if (!validateCard(I("card_no"))) {
			//$this->error("Invalid credit card number!");
		}
		$reg_cvv = "/^\d{3,4}$/";
		if (!preg_match($reg_cvv, I("cvv"))) {
			//$this->error("Invalid cvv value");
		}

		$result['status'] = 3;
		$result['info'] = "Declined";
		return $result;
	}

	public function refund() {

	}

}